<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	<ul id="ul01">
		<li>苹果</li>
		<li>鸭梨</li>
		<li>香蕉</li>			
	</ul>
		<button onclick="del()">删除</button>
		
		<script type="text/javascript">
			
			function del()
			{
				// var ul01 = document.getElementById("ul01");
				console.log(ul01.childNodes.length);
				if(ul01.hasChildNodes()) // 判断是否有子节点
				{
					ul01.removeChild(ul01.lastChild);					
				}
				
			}
			
			
		</script>

	</body>
</html>
